package cn.sirun.com.fca.personal.center.loader;

import com.tencent.cloud.iov.kernel.model.BaseResponse;

import cn.sirun.com.fca.account.model.base.CarInfoDetailResponse;
import cn.sirun.com.fca.personal.center.model.bean.CarListResponse;
import cn.sirun.com.fca.personal.center.model.request.SubmitPlateNumberRequest;
import cn.sirun.com.fca.personal.center.model.request.SubmitUnbindCarRequest;
import cn.sirun.com.fca.personal.center.repo.ProfileRepository;
import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;

public class CarManagerLoader extends PersonalCenterFlowLoader {

    public Observable<BaseResponse<CarListResponse>> getCarList() {
        return ProfileRepository.getInstance().getCarList()
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<Void>> setCurrentVehicle(String din) {
        return ProfileRepository.getInstance().setCurrentVehicle(din)
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<Void>> editCarNumber(SubmitPlateNumberRequest request) {
        return ProfileRepository.getInstance().editCarNumber(request)
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<Void>> unbindCar(SubmitUnbindCarRequest request){
        return ProfileRepository.getInstance().unBindCar(request)
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<CarInfoDetailResponse>> getCarInfo(String din) {
        return ProfileRepository.getInstance().getCarInfoDetail(din)
                .subscribeOn(Schedulers.io());
    }
}
